home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / Telnet 2.6.1d1 4⁄26⁄94 Folder / Krb / kerberos.h < prev    next >
Text File  |  1994-02-14  |  4KB  |  171 lines

  1. #ifdef TN3270
  2. #define WDATA struct cnr_
  3. #endif
  4.  
  5. #ifdef NCSA_ENC
  6. #define WDATA struct WindRec
  7. #endif
  8.  
  9. #include "encrypt.h"
  10. #include "KrbDriver.h"
  11.  
  12. #define MAXKEYLEN 64                    /* for encryption */
  13.  
  14. #define P(x) x
  15.  
  16. /*
  17.  * Kerberos, encryption
  18.  */
  19. #define OPT_AUTHENTICATION 37
  20. #define OPT_ENCRYPT 38
  21.  
  22. #define KRB_REJECT        1        /* Rejected (reason might follow) */
  23. #define KRB_AUTH        0        /* Authentication data follows */
  24. #define KRB_ACCEPT        2        /* Accepted */
  25. #define KRB_CHALLENGE    3        /* Challenge for mutual auth */
  26. #define KRB_RESPONSE    4        /* Response for mutual auth */
  27.  
  28. #define TNQ_IS            0        /* Option is ... */
  29. #define TNQ_SEND        1        /* send option */
  30. #define TNQ_REPLY        2        /* suboption reply */
  31. #define TNQ_NAME        3        /* suboption name */
  32.  
  33. /*
  34. * AUTHENTICATION option types
  35. */
  36. #define AUTH_NULL        0      /* no authentication */
  37. #define AUTH_KERBEROS_V4 1      /* Kerberos version 4 */
  38. #define AUTH_KERBEROS_V5 2      /* Kerberos version 5 */
  39.  
  40. /*
  41. * AUTHENTICATION option modifiers
  42. */
  43. #define AUTH_WHO_MASK         1
  44. #define AUTH_CLIENT_TO_SERVER 0
  45. #define AUTH_SERVER_TO_CLIENT 1
  46. #define AUTH_HOW_MASK         2
  47. #define AUTH_HOW_ONE_WAY      0
  48. #define AUTH_HOW_MUTUAL       2
  49.  
  50. /*
  51.  * suboption buffer offsets 
  52.  */
  53. #define SB_OPTION    0            /* option byte */
  54. #define SB_SUBOPTION 1          /* is, send, reply, name */
  55. #define SB_TYPE      2          /* authentication type */
  56. #define SB_MODIFIER  3          /* type modifier */
  57. #define SB_DATATYPE  4          /* type of data */
  58. #define SB_DATA      5          /* offset to first data byte */
  59.  
  60. /*
  61.  * ENCRYPTION suboptions
  62.  */
  63. #define    ENCRYPT_IS            0    /* I pick encryption type ... */
  64. #define    ENCRYPT_SUPPORT        1    /* I support encryption types ... */
  65. #define    ENCRYPT_REPLY        2    /* Initial setup response */
  66. #define    ENCRYPT_START        3    /* Am starting to send encrypted */
  67. #define    ENCRYPT_END            4    /* Am ending encrypted */
  68. #define    ENCRYPT_REQSTART    5    /* Request you start encrypting */
  69. #define    ENCRYPT_REQEND        6    /* Request you send encrypting */
  70. #define    ENCRYPT_ENC_KEYID    7
  71. #define    ENCRYPT_DEC_KEYID    8
  72. #define    ENCRYPT_CNT            9
  73.  
  74. #define    ENCTYPE_ANY            0
  75. #define    ENCTYPE_DES_CFB64    1
  76. #define    ENCTYPE_DES_OFB64    2
  77. #define    ENCTYPE_CNT            3
  78.  
  79. #define    IAC    255
  80. #define    SB    250
  81. #define    SE    240
  82.  
  83. struct key_info {                        /* for encryption */
  84.     unsigned char keyid[MAXKEYLEN];
  85.     long keylen;
  86.     long dir;
  87.     long *modep;
  88. #ifdef MPW
  89.     Encryptions *(*getcrypt)();
  90. #else
  91.     Encryptions *(*getcrypt)(struct edata_ *, long);
  92. #endif
  93. };
  94.  
  95. struct fb {                                /* for encryption */
  96.     des_cblock krbdes_key;
  97.     des_key_schedule krbdes_sched;
  98.     Block temp_feed;
  99.     unsigned char fb_feed[64];
  100.     long need_start;
  101.     long state[2];
  102.     long keyid[2];
  103.     long once;
  104.     struct stinfo {
  105.         des_cblock            str_output;
  106.         des_cblock            str_feed;
  107.         des_cblock            str_iv;
  108.         des_cblock            str_ikey;
  109.         des_key_schedule    str_sched;
  110.         long            str_index;
  111.         long            str_flagshift;
  112.     } streams[2];
  113. };
  114.  
  115.  
  116.  #ifdef notdef
  117.      short will_wont_resp_encrypt;
  118.      short do_dont_resp_encrypt;
  119.      short o_encrypt;
  120.  #endif
  121.  
  122.  
  123.  #define BOGUS 0xf0d01111
  124.  
  125.  /* 
  126.   * Encryption data 
  127.   */
  128.  typedef struct edata_ {
  129.      void (*encrypt_output)(void *, unsigned char *, long);
  130.      long (*decrypt_input)(void *, long);
  131.  
  132.      long encrypt_debug_mode;
  133.      long decrypt_mode;
  134.      long encrypt_mode;
  135.      long encrypt_verbose;
  136.      long havesessionkey;
  137.      long autoencrypt;
  138.      long autodecrypt;
  139.  
  140.      long Server;
  141.      char *Name;
  142.   
  143.      long i_support_encrypt;
  144.      long i_support_decrypt;
  145.      long i_wont_support_encrypt;
  146.      long i_wont_support_decrypt;
  147.   
  148.      long remote_supports_encrypt;
  149.      long remote_supports_decrypt;
  150.   
  151.      unsigned char str_send[64];
  152.      unsigned char str_suplen;
  153.      unsigned char str_start[72];
  154.      unsigned char str_end[6];
  155.   
  156.      struct key_info ki[2];
  157.      unsigned char str_keyid[(MAXKEYLEN*2)+5];
  158.   
  159.      struct fb fb[2];
  160.      
  161.      WDATA *wp;
  162.  } CDATA;
  163.  
  164.  /* 
  165.   * Authorization / encryption data 
  166.   */
  167.  #define ADATA \
  168.       char auth_response[8];        /* kerberos expected authorization response */ \
  169.      char auth_challenge[8];      /* kerberos authorization challenge */ \
  170.      CDATA *edata;
  171.